package Tengxun_News;

import East_newsK.News_analysis;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

import java.util.List;

public class Get_Tenxun_News_Url {
    public static void main(String[] args) throws Exception{
        String url ="https://news.qq.com/";
        getTargetgUrl(url);
    }


    public  static void getTargetgUrl(String url) throws Exception {
        System.setProperty("webdriver.chrome.driver", "E:\\Java\\工具包\\Chromedriver\\chromedriver.exe");

        WebDriver driver = new ChromeDriver();
        driver.get(url);

            //获取本业的目标链接
            List<WebElement> list =driver.findElements(By.cssSelector(".detail h3 a"));
            for (WebElement webElement : list) {
                String href = webElement.getAttribute("href");
                System.out.println(href);
                System.out.println("开始解析页面！");
                News_analysis.news_analysis(href,".content-article .one-p");
            }


    }
}
